home *** CD-ROM | disk | FTP | other *** search
-
-
- #ifndef ARRAY_H
- #define ARRAY_H
-
- #include <stdlib.h>
-
- typedef struct _array *Array;
-
- struct _array
- {
- void **data;
- unsigned int size;
- unsigned int used;
- };
-
- /* Creates an Array, of the given size and returns it */
-
- Array array_alloc(unsigned int aSize);
-
- /* Frees and array, not the items in it */
-
- void array_free(Array anArray);
-
- /* Frees the items, not the array */
-
- void array_freeItems(Array anArray);
-
- /* returns the current size of an Array */
-
- int array_count(Array anArray);
-
- /* Sets the capacity of the array */
-
- void array_setCapacity(Array anArray,unsigned int aSize);
-
- /* Adds an item to the end of the array */
-
- void array_addItem(Array anArray,void *anItem);
-
- /* Inserts an item into the array */
-
- void array_addItemAt(Array anArray,void *anItem,unsigned int index);
-
- /* Returns an item from the array */
-
- void * array_itemAt(Array anArray,unsigned int index);
-
- /* Removes an item from the array, and returns it */
-
- void * array_removeItemAt(Array anArray,unsigned int index);
-
- #endif
-
-